<?php

/**
 * Items form base class.
 *
 * @method Items getObject() Returns the current form's model object
 *
 * @package    cmsot
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseItemsForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'               => new sfWidgetFormInputHidden(),
      'url'              => new sfWidgetFormInputText(),
      'code_1c'          => new sfWidgetFormInputText(),
      'dt_on'            => new sfWidgetFormDate(),
      'dt_off'           => new sfWidgetFormDate(),
      'rank'             => new sfWidgetFormInputText(),
      'sw'               => new sfWidgetFormInputText(),
      'sw_menu'          => new sfWidgetFormInputText(),
      'sw_index'         => new sfWidgetFormInputText(),
      'meta_title'       => new sfWidgetFormInputText(),
      'meta_keywords'    => new sfWidgetFormInputText(),
      'meta_description' => new sfWidgetFormInputText(),
      'item_name'        => new sfWidgetFormInputText(),
      'item_headline'    => new sfWidgetFormTextarea(),
      'item_about'       => new sfWidgetFormTextarea(),
      'item_description' => new sfWidgetFormTextarea(),
      'site_name'        => new sfWidgetFormInputText(),
      'site_href'        => new sfWidgetFormInputText(),
      'item_type'        => new sfWidgetFormInputText(),
      'created_at'       => new sfWidgetFormDateTime(),
      'updated_at'       => new sfWidgetFormDateTime(),
      'created_by'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Creator'), 'add_empty' => true)),
      'updated_by'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Updator'), 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'id'               => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'url'              => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'code_1c'          => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'dt_on'            => new sfValidatorDate(array('required' => false)),
      'dt_off'           => new sfValidatorDate(array('required' => false)),
      'rank'             => new sfValidatorInteger(array('required' => false)),
      'sw'               => new sfValidatorInteger(array('required' => false)),
      'sw_menu'          => new sfValidatorInteger(array('required' => false)),
      'sw_index'         => new sfValidatorInteger(array('required' => false)),
      'meta_title'       => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'meta_keywords'    => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'meta_description' => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'item_name'        => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'item_headline'    => new sfValidatorString(array('required' => false)),
      'item_about'       => new sfValidatorString(array('required' => false)),
      'item_description' => new sfValidatorString(array('required' => false)),
      'site_name'        => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'site_href'        => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'item_type'        => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'created_at'       => new sfValidatorDateTime(),
      'updated_at'       => new sfValidatorDateTime(),
      'created_by'       => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Creator'), 'required' => false)),
      'updated_by'       => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Updator'), 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('items[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Items';
  }

}
